home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Newsletters / GEnieUnixNews / unxnl-01.91 < prev    next >
Text File  |  1992-12-27  |  16KB  |  390 lines

  1.  
  2.           _ __  _   _ __ _ __
  3.          // /  //| // || \\|     N E W S
  4.         //_/  // |//  ||  |\\    Vol 2, Issue 1 - January 1991
  5.          R o u n d T a b l e
  6.  
  7.    Items of interest to participants of the GEnie Unix RoundTable
  8.  
  9.       The RoundTable SysOps are:
  10.       Dave Weinstein......OLORIN     Brian Riley.........DELPHI
  11.       Gary Smith..........GARS       Chris North-Keys....HARP
  12.       Rick Mobley.........LRARK    All Unix SysOps.....UNIXSYSOPS$
  13.    We strongly encourage you to contact any or all of us if you have -ANY-
  14.  comments or suggestions. This is -YOUR- RoundTable. We are here to make
  15.  your participation as pleasant and beneficial as possible.
  16.  
  17.  ED: editor notes - cooperatives sought.
  18.  --
  19.     In an ongoing effort to make your GEnie Unix RoundTable the resource
  20.  you are proud to participte in we have begun a search for cooperative
  21.  contributors/participants. These will be groups/organizations who have
  22.  meaningful material to present to Unix users, but are not large enough to
  23.  support thier own RoundTable. An example which has worked well is the
  24.  newsclip area Mitch Wagner of 'Unix Today' maintains. Other concepts
  25.  might be a public domain C source repository or a Unix education group.
  26.  The qualifying (operative word) contributor must maintain their topic 
  27.  area and make periodic contributions as appropriate to their topic. In
  28.  return we will make a topic available for their use alone. 
  29.     You can help. If you know of any potential contributors please leave
  30.  e-mail to Unixsysops$ with as much information as possible - especially
  31.  a phone number and contact would be most helpful. We will pursue the
  32.  qualification and extend an invitation if deemed appropriate.
  33.     We want this to be the single best public Unix resource available. 
  34.  Please help us in this quest.        Gary   gars@glsrk
  35.  
  36.    
  37.  SAY WHAT ?   lead SysOp Dave Weinstein offers this head scratcher:
  38.  ----------
  39.  
  40.  Sub: Happy New Year
  41.  
  42.  This wins as the single most twisted script I have ever seen...
  43.  
  44.  Would you like a program which sounds equally well
  45.  in Bourne Shell, C Shell, C, C++ and even in FORTRAN?
  46.  Enjoy!
  47.  
  48.  cat /*dev/null; echo "Happy New Year"\!
  49.  cat <<c*/ /*dev/null | cat > /dev/null
  50.  c */ () {} /*
  51.  c */ main() { cat(); printf("Happy New Year!\n"); } /*
  52.  17      format('  Happy New Year!')
  53.          write (6,17)
  54.          stop
  55.          end
  56.  c*/
  57.  
  58.  Greetings!
  59.  
  60.  Vadim Antonov
  61.  DEMOS, Moscow, USSR
  62.    
  63.  AWK is _NOT_ a BIRD !
  64.  ---------------------
  65.   From the net comes this little exchange on using Messrs Aho, Weinberger
  66.   and Kernighan's lexigraphical language. If there is interest in awk()
  67.   let me know and we will continue to include awk usage articles in the 
  68.   newsletter. gars
  69.  
  70.  In article <1543@manta.NOSC.MIL> plantz@manta.NOSC.MIL writes:
  71.  >
  72.  >I need to use awk to scan a file that consists of lines, each line 
  73.  >starting with an integer, followed by a line of text that should have 
  74.  >a period and then a newline character following that. The script should 
  75.  >save the number>at the beginning of the line, and if the line does not 
  76.  >have a "period" prior to the  "newline", to print out a message, with 
  77.  >the integer number that was at the beginning of the line.
  78.  >
  79.  
  80.  Well, here's a quick solution to your problem.  This has been tested on
  81.  an AT&T 3B2/1000 running SVR3.2.2.......
  82.  
  83.  Given this text file "testtext":
  84.  
  85.  1 this is a test of this function.
  86.  2 i think this is an editing application.
  87.  3 it might work in any text processor, though
  88.  999 a troff-like system could also use this stuff.
  89.  
  90.  and this script:
  91.  
  92.  #!/bin/sh
  93.  # 
  94.  # hack out and validate lines preceded by integers.
  95.  
  96.  awk '{ linenum = $1;
  97.         if (index($NF,".") == 0) {
  98.            printf("Error in line %d; no period\n",linenum);
  99.         } else {
  100.            print;
  101.         }
  102.        }' testtext
  103.  
  104.  You get this output:
  105.  
  106.  1 this is a test of this function.
  107.  2 i think this is an editing application.
  108.  Error in line 3; no period
  109.  999 a troff-like system could also use this stuff.
  110.  
  111.  If you need some more help, feel free to get in touch.  I don't claim 
  112.  that this is an elegant solution, but it's the old "top-of-the-head"
  113.  solution.....
  114.  
  115.  O'Reilly and Associates have just published "sed & awk", the newest
  116.  of their Nutshell handbooks.  It's easy to read, and includes many
  117.  working scripts, 10 of which were submitted by Usenet readers.
  118.  
  119.  -- 
  120.      | Wes Morgan, not speaking for | {any major site}!ukma!ukecc!morgan | 
  121.      | the University of Kentucky's |        morgan@engr.uky.edu         |
  122.      | Engineering Computing Center |   morgan%engr.uky.edu@UKCC.BITNET  | 
  123.       Lint is the compiler's only means of dampening the programmer's ego.
  124.   ------------------
  125.  
  126.  FAST and NASTY, DOWN  and  DIRTY:  quick  fix scripts that do something
  127.  --------------------------------
  128.  
  129.  lowercase tr script:
  130.  ------------------- 
  131.  >From rick (lrark). script to change UPPERCASE filenames to lowercase
  132.  
  133.  Thought I might dig up some tidbits for the newsletter. Here is a nice small
  134.  script that seems useful for filenames that come across in upper case.
  135.  
  136.  -- Usenet message begins --
  137.  
  138.  I think all the programs posted so far have the bug that if you have
  139.  files called "x" and "X", they will delete one of them.  Here's mine.
  140.  Doesn't disturb files whose names already contain any lowercase
  141.  characters (thus preserving names like "Makefile"), and even has online
  142.  help!  Not shar'd, cut out and use.
  143.  
  144.  #! /bin/sh
  145.  # converts to lowercase
  146.  if test $# -lt 1; then
  147.     echo "usage: lfname file ..."
  148.     echo "(specified filenames are converted to lowercase)"
  149.     exit 1
  150.  fi
  151.  
  152.  for f in "$@"
  153.  do
  154.     case "$f" in
  155.     *[a-z]*)
  156.        #echo "skipping $f, contains lowercase chars"
  157.        ;;
  158.     *)
  159.        newname=`echo "$f" | tr 'A-Z' 'a-z'`
  160.        if test "$newname" != "$f"
  161.        then
  162.           if test -f "$newname"
  163.           then
  164.              echo "$newname already exists"
  165.           else
  166.              mv "$f" "$newname"
  167.           fi
  168.        fi
  169.        ;;
  170.     esac
  171.  done
  172.  exit 0
  173.  --
  174.  Rahul Dhesi <dhesi%cirrusl@oliveb.ATC.olivetti.com>
  175.  UUCP:  oliveb!cirrusl!dhesi
  176.  
  177.  For us Xenix folks there is one line that needs to be changed.
  178.  
  179.  change: tr 'A-Z' 'a-z'
  180.  
  181.  to: tr [A-Z] [a-z]
  182.  
  183.  works like a charm..
  184.  
  185.  rick@lrark 
  186.  
  187.  Microport users will also need to use the bracketed arguments. gars
  188.  
  189.   timed.sh :
  190.   --------
  191.   Study this script - closely. Run it. Play with it. You will profit by 
  192.   learning a LOT about some script commands that may be obscure to you
  193.   and should not be. gars
  194.  
  195.  #!/bin/sh
  196.     delay=60
  197.     trap 'trap 14' 14
  198.     echo "What is your Quest? \c"
  199.     (sleep $delay; kill -14 $$ 2>/dev/null)&
  200.     read YourQuest
  201.     kill $! 2>/dev/null
  202.     [ ! -z "$YourQuest" ] && echo "Bah. Humbug. Not interested in $YourQuest" \
  203.                 || echo "You must be interested in something!"
  204.    
  205.  BUILDING your PLATFORM:
  206.  ----------------------     
  207.  
  208.  CONFIGURATION ( fellow SysOp Brian Riley (delphi) continues his discussion
  209.        on how to customize the U/A on a Unix system using a 3b1 as his model)
  210.        
  211.        * editor's note: part 1 of this series is available in UNXNL-10.90
  212.                  posted in library 1 of the GEnie Unix RT software libraries.
  213.                               ---------------
  214.                       Customizing the User Agent (tm)
  215.                             on the Unix Pc (tm)
  216.                              by Brian T. Riley
  217.  
  218.                                    Part 2
  219.  
  220.      Welcome back folks! This month we will continue to explore the
  221.      wonderous world of the User Agent. We will examine the structure and
  222.      purpose of Suffixes, Preferences and Environment. And for
  223.      those of you using 3.51 , or higher, of Unix on your systems and don't
  224.      have the Calendar package, you are in for a treat because...
  225.      Surprise!! It's already there! Your UA just doesn't know it yet. :)
  226.      (It may be there in 3.5 but I personally can't remember that far back.)
  227.      In fact, let's start there first. Ok? Here we go.
  228.  
  229.      Last month we modified the UNIX System menu object to give us a
  230.      dimensionless window to the Unix command line. From the Office menu
  231.      select Unix System and you should recieve the standard $ prompt
  232.      without the border. If you are logged into the system from a terminal
  233.      instead of the Console then you should execute the following command
  234.      first;
  235.  
  236.      $ clear <return>
  237.  
  238.      Next we need to find the files we need for the Calendar. Type in the
  239.      following commands;
  240.  
  241.      $ cd /etc/fixes <ret>
  242.      $ ls -l <ret>
  243.      $ cp pcal /usr/bin <ret>
  244.      $ cp pcal.hlp /usr/lib/ua <ret>
  245.      $ cd $HOME <ret>
  246.  
  247.      Ok, now we have the files where we want them, but, the UA still
  248.      doesn't know they are there. In order to set this up properly, we will
  249.      need to modify two files, Office and Preferences. Let's start with the
  250.      Office file. Exit back to the UA and select Home from the Office menu.
  251.      Now Open the Office file. If you did everything right last month you
  252.      should see the contents of the Office file in your favorite editor.
  253.      What? You say it doesn't look right? You probably still have "ed" set
  254.      as your default editor. So, type a "q" and hit return. Now, select
  255.      Preferences from the Office menu. Then select Office. You should now
  256.      see several options here. You may wish to experiment with the settings
  257.      before we go on, just don't forget to refresh the Office menu after
  258.      you change something. The option we are looking for right now is the
  259.      Default Editor: line, which should say "/bin/ed". For right now let's
  260.      change it to "/usr/bin/vi" and later you can change it to something
  261.      else if you wish. Now press Enter and do a refresh. Then select the
  262.      Home object and Open the Office file. If you get an error you will
  263.      need to install the Enhanced Editors disk that came with your system
  264.      or use annother editor. For the rest of this article I will assume we
  265.      are all using the vi editor.
  266.  
  267.      We need to add a new object to the Office file for the Calendar. To do
  268.      this, add the following lines to you Office file;
  269.  
  270.      Name= Calendar
  271.      Default= Open
  272.      Open= EXEC -d /usr/bin/pcal -c
  273.      Help= EXEC -d /usr/bin/uahelp -h /usr/lib/ua/ua.hlp -t Calendar
  274.  
  275.      We also want to be able to change the default features of the Calendar
  276.      so we need to copy the Preferences file to our Home directory and edit
  277.      it. Add these lines to your new Preferences file;
  278.  
  279.      Name= Calendar
  280.      Default= Open
  281.      Open= EXEC -d /usr/bin/pcal -p
  282.      Help= EXEC -d /usr/bin/uahelp -h /usr/lib/ua/ua.hlp -t Calendar
  283.  
  284.      As you can see, the Preferences file is set up the same as the Office
  285.      File, but, is only usefull for programs that allow customizing. One
  286.      difference is that for changes in the Preferences file to take effect
  287.      you must logout and login again. You may be wondering what other
  288.      programs you can set up Preferences for. Well, if you use the Korn
  289.      Shell, Vi, Elm or just want to modify your .profile more easily you
  290.      can do this;
  291.  
  292.      Name = Vi Editor
  293.      Default = Open
  294.      Open = EXEC -wd /usr/bin/vi $HOME/.exrc
  295.  
  296.      And substitute the appropriate Name= value and .filename in the Open=
  297.      value. As you can see, the User Agent can be very flexible.
  298.  
  299.      The Suffixes file defines descriptions for files that have a specific
  300.      suffix such as :Am for a modem profile, and what to do with them when
  301.      they are selected from the UA. The structure of the Suffixes file is
  302.      simmilar to Office but is used differently. The minimum required
  303.      information is Name=, Description=, Default=, and whatever keyword is
  304.      defined as default. Here is an example;
  305.  
  306.      Name=Installable File
  307.      Suffix=+IN
  308.      Description=*Installable File
  309.      Default=Open
  310.      Open=SH -pw /usr/bin/Instcpio.sh %o
  311.      Create= ERROR
  312.      Help=EXEC -d /usr/bin/uahelp -h /usr/lib/ua/admin.hlp -t "Email
  313.      Software"
  314.  
  315.      There are a couple things we should mention here. Namely the "*" in
  316.      the description and the value of Create. The "*" indicates that when
  317.      the file is displayed in the UA the suffix will be left off of the
  318.      file and just the description will be used to identify it. The ERROR
  319.      in Create= tells the UA that this type of file cannot be created from
  320.      within the UA and the user should be notified.
  321.  
  322.      Finally, the Environment file is created when a user changes the
  323.      values in the Office object from Preferences. However, it can be a
  324.      little more usefull than that. Even though the Preferences menu for
  325.      Office only shows the options that it has built in, the Environment
  326.      file can contain additional variables that will only be set when the
  327.      user logs in and the UA is run. If you wish to set other environment
  328.      variables you can add them to the Environment file in your home
  329.      directory, but you must do it manually.
  330.  
  331.      In closing I should mention that the modifications we have made are
  332.      only in effect for your login but they can just as easily be made
  333.      system wide by modifying the master files in /usr/lib/ua. However, you
  334.      will need superuser priveledges in order to do it. Next time we will
  335.      explore the wonders of the Korn shell, make it possible to decide
  336.      between the UA and the command line from our login, and examine the
  337.      structure of an Installable file. Have a good month! ;)
  338.  
  339.  WHO: meeting members of the Unix RT (this one needs to be flame resistant)
  340.  ----
  341.  To all who may have reason to enter into a friendly wager with our
  342.  illustrious leader and otherwise nice guy, Dave Weinstein... DON'T !
  343.    
  344.   I really like Dave, and he really is trustworthy in all other areas
  345.   of our acquaintance, but he just can NOT seem to bring himself to
  346.   comply with a simple, fun, gentleman's wager.
  347.   
  348.  It is once again basketball season. That is what prompted the issuance
  349.  of this little missive. You may recall we had a basketball season a
  350.  year ago, also. Seems like ages ago, doesn't it ? Anyway, in that long
  351.  ago basketball season of 1990 Dave lived in the city of Austin and I
  352.  in Little Rock. You need to live in one of those two cities to truly
  353.  appreciate the dire consequences of our wager, but suffice it to say
  354.  there is not a great deal of love and affection between fans of the
  355.  University of Texas Longhorns and fans of the University of Arkansas
  356.  Razorbacks.
  357.    
  358.  The wager was simply this... whoever's team lost the Southwest Conference
  359.  Championship Tourney had to wear the cap of the other school in public
  360.  and provide photographic proof of compliance.
  361.    
  362.  Texas and Dave lost, and to this day - ten months later - I have yet to 
  363.  see any such photo(s) though they have been promised several times; and
  364.  Dave now lives in Denver. Well, his residence is in Colorado. Obviously,
  365.  his sense of sportsmanship still resides in Texas. gars
  366.  
  367.     O-o-o-o-o-o Pig ! Sooie ! RAZORBACKS !!
  368.  
  369.  ---------------    
  370.     REMINDER - This newsletter is being sent to you 'by request'. If you do
  371.  not wish to keep receiving it, e-mail a stop notice to GARS. On the other
  372.  hand, we would very much appreciate it if you would pass the word that we
  373.  do distribute this item near the tenth (10th) of each  month to anyone on
  374.  GEnie who requests it, and will gladly add any name that is requested via
  375.  the same route... e-mail to GARS.
  376.    P L E A S E  also remember contributions are most welcome. Please e-mail
  377.  items and/or suggestions to GARS.
  378.  
  379.  (EOF)
  380.  
  381.  Trademark and Copyright notices:
  382.  Unix is a Trademark of  AT&T; GEnie, LiveWire, and RoundTable are Trademarks
  383.  of General Electric Information Services  Company;  Xenix is a Trademark  of
  384.  Microsoft  Corporation; Unix Today is a Trademark of CMP Publications, Inc.,
  385.  Microport is a Trademark of Microport Systems, Inc.
  386.    
  387. The contents of this newsletter are copyright (c) 1991 and may be copied whole
  388. or in part only if  original  credit is included. The GEnie UNIX RoundTable is
  389. not affiliated with AT&T.
  390. ay be copied who